﻿<UserControl x:Class="Kokomo.PeInspector.Reflection.AssemblyResourcesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:r="clr-namespace:Kokomo.PeInspector.Reflection"
			 xmlns:ui="clr-namespace:Kokomo;assembly=Kokomo.UI"
			 xmlns:svc="clr-namespace:Kokomo.Environment.Services;assembly=Kokomo.Environment"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>
		<ToolBar>
			<Button Command="{Binding SaveResourceCommand}">
				<TextBlock>
					<Image
						Source="{svc:Image {x:Static svc:StandardImageKeys.SaveDocument}}"
						Width="16"
						Height="16"
						/>
					<Run Text="Save Resource"/>
				</TextBlock>
			</Button>
		</ToolBar>
		<ListView
			Grid.Row="1"
			ItemsSource="{Binding ResourceItems}"
			SelectedItem="{Binding Path=SelectedResourceItem, Mode=OneWayToSource}"
			TextSearch.TextPath="Name"
			ui:ListViewHelper.IsSortingEnabled="True"
			ui:ListViewHelper.ItemActivatedCommand="{Binding NavigateToCommand}"
			>
			<ListView.Resources>
				<Style TargetType="{x:Type ListViewItem}">
					<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
				</Style>
			</ListView.Resources>
			<ListView.ItemContainerStyle>
				<Style>
					<Setter Property="ui:ListViewHelper.ItemParameter" Value="{Binding Resource}"/>
				</Style>
			</ListView.ItemContainerStyle>
			<ListView.View>
				<GridView>
					<GridViewColumn Header="Name" ui:ListViewHelper.SortPropertyName="Name" DisplayMemberBinding="{Binding Name}" Width="500"/>
					<GridViewColumn Header="Size" ui:ListViewHelper.SortPropertyName="Size">
						<GridViewColumn.CellTemplate>
							<DataTemplate DataType="{x:Type r:AssemblyResourceItem}">
								<TextBlock Text="{Binding Path=Size, StringFormat={}{0:N0}}" TextAlignment="Right"/>
							</DataTemplate>
						</GridViewColumn.CellTemplate>
					</GridViewColumn>
				</GridView>
			</ListView.View>
		</ListView>
	</Grid>
</UserControl>
